<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ taglib uri="/struts-tags" prefix="s"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript">
function sum(){
 var pr = document.getElementsByName("pr");
 var s = 0.0;
 for( i = 0; i < pr.length; i++){
	 s += parseFloat(pr[i].value);
 }
 alert("一共需要"+s+"元，请确认付款");
}
</script>
</head>
<body>
<table>
<tr> 
	<td>商品名称</td><td>商品价格</td><td>商品数量</td></tr>
<s:iterator value="#session.car" var="c">
<tr> 
	<input type="hidden" value="${c.pprice }" name="pr">
	<td>${c.pname}</td><td>${c.pprice}</td><td>${1}</td></tr>
</s:iterator>
</table>
<a href="#" onclick="sum()">结算</a>
</body>
</html>